import java.util.Random;
import java.util.Scanner;

public class Test {
    /*public static void main1(String[] args) {
        int n=100;
        while(n<=200){
            if(n%3==0&&n%4==0){
                System.out.println(n);
            }
            n++;
        }
    }*/

   /* public static void main2(String[] args) {
        short a=128;
        byte b=(byte)a;
        System.out.println(a);
        System.out.println(b);
    }*/
    //求1-100中出现9的次数
   /*public static void main4(String[] args) {
       int count=0;
       for (int i = 1; i < 101; i++) {
           if(i%10==9||i/10==9){
               if(i%10==9&&i/10==9){
                   count=count+2;
               }
               count++;
           }

       }
       System.out.println(count);
   }*/
    //求1-1/2+/3-1/4........
   public static void main(String[] args) {
       double count=0.0;
        int flag=1;
       for (int i = 1 ; i <=100 ; i++) {
           count+=(1.0/i)*flag;
           flag=-flag;




           //count += (1.0/i)*(Math.pow(i+1,-1));

       }
       System.out.println(count);

   }
   //猜数字游戏

   /*public static void main6(String[] args) {
       Scanner sc=new Scanner(System.in);

       Random random=new Random();

       int ra=random.nextInt(101);
       while(true){
           System.out.println("请输入您猜的数字:");
           int read=sc.nextInt();

           if(read>ra){
               System.out.println("猜大了");
           }else if(read<ra){
               System.out.println("猜小了");
           }else{
               System.out.println("猜对了");
               break;
           }
       }scan.close();
   }*/
   /*public static void main7(String[] args) {
       int num=123;
       int tem=num;
       while(true){
           int a=0;
           a=num%10;
           System.out.println(a);
           num=num/10;
           int b=num%10;
           System.out.println(b);
           num=num/10;
           num=num%10;
           System.out.println(num);
           if(num/10==0){
               break;
           }
       }


   }*/
   //模拟密码登录
    /*public static void main(String[] args) {
       Scanner sc=new Scanner(System.in);
       int count=3;
       while(count!=0){
           System.out.println("请输入密码:");
           String password=sc.nextLine();
           if(password.equals("123456")){
               System.out.println("登陆成功");
               break;
           }else{
               count--;
               System.out.println("输入错误,请重新输入,你还有"+count+"次机会");
           }
       }

   }*/
   //有点小问题   分别输出一个二进制序列的奇数位和偶数位
    /*public static void main(String[] args) {
       Scanner scanner=new Scanner(System.in);
       int n=scanner.nextInt();
       int []arr=new int[16];
       int []brr=new int[16];
       int i=0;
       int j=0;
       int k=0;
       for(i=1;i<32;i++){
           if(i%2!=0){
               arr[j]=n&1;
               j++;
               n>>>=1;
           }else{
               brr[k]=n&1;
               k++;
               n>>>=1;
           }
       }
       System.out.println("现在打印奇数位");
       for (int m = 0; m < 16; i++) {
           System.out.println(arr[15-i]+" ");

       }*/
       /*System.out.println("");
       System.out.println("现在打印偶数位:");
       for (int l = 0; l <16 ; l++) {
           System.out.println(brr[15-l]+" ");
       }

   }*/
   //有问题    求俩个数的最大公约数
    /*public static void main(String[] args) {
       System.out.println("请输入第一个数m的值:");

       Scanner scanner=new Scanner(System.in);
       int m=scanner.nextInt();
       System.out.println("请输入第二个数n的值:");
       Scanner sc=new Scanner(System.in);
       int n=sc.nextInt();
       int temp=0;
       if(m<n){
           temp=m;
           m=n;
           n=temp;
       }
       while(n!=0){
           temp=m%n;
           m=n;
           n=temp;

       }
        System.out.println("m和n的最大公约数是:"+m);





       }*/

  /* }
*/
   /* public static void main(String[] args) {

    }*/
}


